import request from '@/utils/request'
import _ from 'lodash'

// 查询活动房间列表
export function listActivityFood(query) {
  query.pageNum = 1
  query.pageSize = 999
  return request({
    url: '/logex/activityFood/list',
    method: 'get',
    params: query
  }).then((res) => {
    _.each(res.rows, (r) => {
      if (r.psStart) {
        r.psTime = [r.psStart, r.psEnd]
      } else {
        r.psTime = null
      }
    })
    return res
  })
}

// 查询活动房间详细
export function getActivityFood(id) {
  return request({
    url: '/logex/activityFood/' + id,
    method: 'get'
  })
}

// 新增活动房间
export function addActivityFood(data) {
  return request({
    url: '/logex/activityFood',
    method: 'post',
    data: data
  })
}

// 修改活动房间
export function updateActivityFood(data) {
  return request({
    url: '/logex/activityFood',
    method: 'put',
    data: data
  })
}

export function putData(data) {
  return request({
    url: '/logex/activityFood/putData',
    method: 'put',
    data: data
  })
}

// 删除活动房间
export function delActivityFood(id) {
  return request({
    url: '/logex/activityFood/' + id,
    method: 'delete'
  })
}

export function addActivityFoodBatch(data) {
  return request({
    url: '/logex/activityFood/insertBatch',
    method: 'post',
    data: data
  })
}
